-- @owner: lvlintao
-- @date: 2025-4-10
-- @testpoint:D兼容性-中括号[]包裹标识符，function名使用中括号包裹标识符，成功
--step1.新建function;expect:成功
@connect PrimaryDbDmode;
set d_format_behavior_compat_options='enable_sbr_identifier';
drop function if exists [func_1];
drop function if exists [func_2];
drop function if exists [func_3];
drop function if exists [func_4];
drop function if exists [func_5];
drop function if exists [func_6];
drop function if exists [func_7];

CREATE FUNCTION [func_1] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_2] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_3] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_4] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_5] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_6] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

CREATE FUNCTION [func_7] (in int, out f1 int, out f2 text)
    AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
    LANGUAGE SQL;
/

--step2.修改function名;expect:成功
alter function [func_1](in int, out f1 int, out f2 text) rename to [Abc_abc];
alter function [func_2](in int, out f1 int, out f2 text) rename to [_123];
alter function [func_3](in int, out f1 int, out f2 text) rename to [!@#$%^_];
alter function [func_4](in int, out f1 int, out f2 text) rename to [[[];
alter function [func_5](in int, out f1 int, out f2 text) rename to [  _];
alter function [func_6](in int, out f1 int, out f2 text) rename to [''];
alter function [func_7](in int, out f1 int, out f2 text) rename to [""];

--step3.清理环境;expect:成功
drop function if exists [Abc_abc];
drop function if exists [_123];
drop function if exists [!@#$%^_];
drop function if exists [[[];
drop function if exists [  _];
drop function if exists [''];
drop function if exists [""];

